using System;
using System.Data.Linq.Mapping;
using System.Runtime.Serialization;
using CoreLibrary.Date;
using Entities.Enumeration;

namespace Entities.DataBase.Persistent {

    [DataContract]
    [Table(Name="D_PACKAGE")]
    public class Package {

        public Package() {
            Type          = PackageType.Normal.Type;
            Data          = string.Empty;
            Description   = string.Empty;
            CourierId     = Courier.Other.Code;
            TrackingId    = string.Empty;
            Status        = PackageStatus.PENDING;
            DateCreated   = DateTime.UtcNow;
            DateUpdated   = DateUtil.Epoch;
            DateDelivered = DateUtil.Epoch;
        }

        [DataMember]
        [Column(Name="ID", IsPrimaryKey = true)]
        public string Id { get; set; }

        [DataMember]
        [Column(Name = "TRACKING_ID")]
        public string TrackingId { get; set; }

        [DataMember]
        [Column(Name = "TYPE")]
        public int Type  { get; set; }

        [DataMember]
        [Column(Name = "REFERENCE")]
        public string Reference { get; set; }

        [DataMember]
        [Column(Name = "RECIPIENT")]
        public string Recipient { get; set; }

        [DataMember]
        [Column(Name = "COURIER_ID")]
        public int CourierId { get; set; }

        [DataMember]
        [Column(Name = "STATUS")]
        public int Status { get; set; }

        [DataMember]
        [Column(Name = "DESCRIPTION")]
        public string Description { get; set; }

        [DataMember]
        [Column(Name = "DATA")]
        public string Data { get; set; }

        [DataMember]
        [Column(Name = "PHONE_NUMBER")]
        public string PhoneNumber { get; set; }

        [DataMember]
        [Column(Name = "SHIPPING_ADDRESS")]
        public string ShippingAddress { get; set; }

        [DataMember]
        [Column(Name = "DATE_CREATED")]
        public DateTime DateCreated { get; set; }

        [DataMember]
        [Column(Name = "DATE_UPDATED")]
        public DateTime DateUpdated { get; set; }

        [DataMember]
        [Column(Name = "DATE_DELIVERED")]
        public DateTime DateDelivered { get; set; }

    }
}